<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<meta charset="utf-8">
<head th:include="@{include}::header"></head>
<body>
<div class="layuimini-container">
	<div class="layuimini-main">
		<form class="layui-form layui-form-pane" id="signupForm" name="signupForm">
			<input id="userId" name="userId" th:value="${user.userId}" type="hidden" />
			<input id="userType" name="userType" th:value="7" type="hidden" />
			<div class="layui-form-item">
				<label class="layui-form-label">姓名：</label>
				<div class="layui-input-block">
					<input id="name" name="name" class="layui-input" type="text" th:value="${user.name}">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">用户名：</label>
				<div class="layui-input-block">
					<input id="username" name="username" class="layui-input" type="text" th:value="${user.username}">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">手机号：</label>
				<div class="layui-input-block">
					<input id="mobile" name="mobile" class="layui-input" th:value="${user.mobile}" type="text">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">状态:</label>
				<div class="layui-input-block">
					<label class="radio-inline">
						<input th:field="*{user.status}" type="radio" name="status" value="1" />
						正常
					</label>
					<label class="radio-inline">
						<input th:field="*{user.status}" type="radio" name="status" value="0" />
						禁用
					</label>
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">角色</label>
				<div class="layui-input-block">
					<select data-placeholder="--请选择--" name="roleId" id="roleId">
						<option value="">请选择角色</option>
						<option th:each="role:${roles}" th:value="${role.roleId}" th:text="${role.roleName}"
								th:selected="${user.roleId eq role.roleId}"></option>
					</select>
				</div>
			</div>


			<div class="layui-form-item">
				<label class="layui-form-label">所属乡镇</label>
				<div class="layui-input-block">
					<select name="townId" id="townId" lay-filter="townId" lay-search="">
						<option value="">所属乡镇</option>
						<th:block th:each="d : ${towns}">
							<option th:value="${d.id}" th:text="${d.townName}" th:selected="${user.townId eq d.id}"></option>
						</th:block>
					</select>
				</div>
			</div>


			<div class="layui-form-item">
				<label class="layui-form-label">所属村居</label>
				<div class="layui-input-block">
					<select name="villageId" id="villageId" lay-filter="villageId" lay-search="">
						<option value="">所属村居</option>
						<th:block th:each="d : ${villages}">
							<option th:value="${d.id}" th:text="${d.townName}" th:selected="${user.villageId eq d.id}"></option>
						</th:block>
					</select>
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">权限等级：</label>
				<div class="layui-input-block">
					<select data-placeholder="--请选择--" name="userLevel" id="userLevel" class="layui-input chosen-select">
						<th:block th:if="${currentUser.userLevel == 1}">
							<option value="1" th:selected="${user.userLevel eq 1}">县级</option>
							<option value="2" th:selected="${user.userLevel eq 2}">镇级</option>
							<option value="3" th:selected="${user.userLevel eq 3}">村级</option>
						</th:block>
						<th:block th:if="${currentUser.userLevel == 2}">
							<option value="2" th:selected="${user.userLevel eq 2}">镇级</option>
							<option value="3" th:selected="${user.userLevel eq 3}">村级</option>
						</th:block>
						<th:block th:if="${currentUser.userLevel == 3}">
							<option value="3" th:selected="${user.userLevel eq 3}">村级</option>
						</th:block>
					</select>
				</div>
			</div>

			<div class="layui-form-item">
				<div style="text-align: center;margin-top: 20px">
					<button type="submit" class="layui-btn layui-btn-normal">提交</button>
				</div>
			</div>
		</form>
	</div>
</div>
<div th:include="@{include}::footer"></div>
<script type="text/javascript" th:src="@{/js/appjs/sys/user/edit_baobao.js}"></script>
</body>
</html>
